package com.lsc.record.core.listener;

import java.util.Date;

import com.lsc.record.core.entity.BaseEntity;
import com.mybatisflex.annotation.UpdateListener;

public class BaseEntityUpdateListener implements UpdateListener {

	@Override
	public void onUpdate(Object entity) {
		if (entity instanceof BaseEntity) {
			BaseEntity obj = (BaseEntity) entity;
			obj.setUpdateTime(new Date());
			if(obj.getIsDeleted()!=null && obj.getIsDeleted()==true) {
				obj.setDeleteTime(new Date());
			}
		}
	}
	
}
